/*
 * VarBuffer.h
 *
 *  Created on: 04/10/2014
 *      Author: fede
 */

#ifndef VARBUFFER_H_
#define VARBUFFER_H_

#include <iostream>
#include <fstream>

using namespace std;

class VarBuffer {
public:
	VarBuffer();

	~VarBuffer();

	VarBuffer(const unsigned int maxSize);
	void clear();
	int read(fstream &file);
	int write(fstream &file);
	int pack(const void* object, unsigned short int size);
	int unpack(void* object);
	unsigned short int getBuffSize();
	char* getBuffer();

	unsigned short int bufferSize;
	unsigned short int maxSize;
	char* buffer;
};

#endif /* VARBUFFER_H_ */
